package models

import "gorm.io/gorm"

type Snippet struct {
	gorm.Model        // include ID,CreateAt,UpateAt,DeleteAt
	Title      string `gorm:"not null"`
	Content    string `gorm:"type:text"`
	Tags       []*Tag `gorm:"many2many:snippet_tags;"` //define many2many relation

	// 新增字段
	UserID uint `gorm:"not null"`          // 外键
	User   User `gorm:"foreignKey:UserID"` // 关联的用户
}
